/*****************************************************************************
 * Filename	: define.h
 * Description	:
 * Author		: Lihongxu
 * ---------------------------------------------------------------------------
 * Modification Record:
 *   Version		Name			date 		Content
 *		1.0		Lihongxu			2013-8-16 	Create this file.
 *
 * Note:
 *
 * ---------------------------------------------------------------------------
 * Copyright (c) 2013 Mega Hunt Micro Technology Inc. All Rights Reserved.
 *****************************************************************************/
#ifndef __Define_H__
#define __Define_H__

#ifdef __cplusplus
extern "C" {
#endif

#define ITEM	"MH1612s"
#define COMPILE_TIME	"compile at:" __DATE__" " __TIME__ "\r\n"
#define VERSION				ITEM"_SOC_V0.1.2\r\n"COMPILE_TIME

#include "stdint.h"

typedef unsigned long u32;
typedef unsigned short u16;
typedef unsigned char u8;


typedef unsigned long U32;
typedef unsigned short U16;
typedef unsigned char U8;


#define COM_PKT_CMD_READ_REG 		1
#define COM_PKT_CMD_WRITE_REG	2
#define COM_PKT_CMD_LOAD_PASSWORD_A	3
#define COM_PKT_CMD_LOAD_PASSWORD_B		4
#define COM_PKT_CMD_READ_CARD		5
#define COM_PKT_CMD_WRITE_CARD		6
#define COM_PKT_CMD_INIT_BLOCK		7
#define COM_PKT_CMD_PLUS_ONE_BLOCK	8
#define COM_PKT_CMD_DECREASE_ONE_BLOCK	9
#define COM_PKT_CMD_CARD_NUMBER		0x0A
#define COM_PKT_CMD_CARD_CONTENT		0x0B
#define COM_PKT_CMD_SWITCH_SPI		0x0C
#define COM_PKT_CMD_QUERY_MODE		0x0D
#define COM_PKT_CMD_CHIP_RESET      0x0E
#define COM_PKT_CMD_CARD_TYPE		0x0F
#define COM_PKT_CMD_REQ_SELECT		0x10
#define COM_PKT_CMD_HALT			0x11
#define COM_PKT_CMD_STATISTICS		0x12
#define COM_PKT_CMD_LPCD			0x13
#define COM_PKT_CMD_AUTO_READ_WRITE 0x14
#define COM_PKT_CMD_SOC2014_FIX		0x15
#define COM_PKT_CMD_LPCD_CONFIG_TEST 0x16
#define COM_PKT_CMD_LPCD_CONFIG_TEST_STOP 0x17
#define COM_PKT_CMD_POWERON			0x18
#define COM_PKT_CMD_POWERDOWN		0x19
#define COM_PKT_CMD_AUTO_READ_TYPEB_ID	0x1A
#define COM_PKT_CMD_POWER_SWITCH_ON				0x1C
#define COM_PKT_CMD_POWER_SWITCH_OFF			0x1B
#define COM_PKT_CMD_TYPEC_FELICA_POLLING		0x3F
#define	COM_PKT_CMD_ISO15693_POLLING			0x44
#define	COM_PKT_CMD_MIFARE_RWPOLLING			0x54


#define COM_PKT_CMD_PCD_ENABLE                  0x80
#define COM_PKT_CMD_PICC_ENABLE                 0x81
#define COM_PKT_CMD_SINGLE_EMV                  0x82
#define COM_PKT_CMD_SINGLE_COS                  0x83
#define COM_PKT_CMD_EMV_COS                     0x84

/************************PC机软件与下位机软件通信命令字**************************/

#define COM_PKT_CMD_EMV_READ_REG 		        0x01
#define COM_PKT_CMD_EMV_WRITE_REG		        0x02

#define COM_PKT_CMD_EMV_TEST_START		    0x63
#define COM_PKT_CMD_EMV_TEST_STOP		    0x64
#define COM_PKT_CMD_EMV_TEST_PAUSE		    0x65
#define COM_PKT_CMD_EMV_TEST_IOP		    0x67

//Analog Test
#define COM_PKT_CMD_CARRIER_TEST	    0x70
/* 即波形测试，要求卡机不停的发送WUPA、WUPB命令，直到有卡回应为止*/
#define COM_PKT_CMD_POLLING_TEST	    0x71
#define COM_PKT_CMD_RESET_TEST		    0x72
#define COM_PKT_CMD_WUPA_TEST		    0x73
#define COM_PKT_CMD_WUPA_RATS_TEST	    0x74
#define COM_PKT_CMD_WUPB_TEST		    0x75
#define	COM_PKT_CMD_WUPB_ATTRIB_TEST	0x76
#define COM_PKT_CMD_TRANSAC_A_TEST 		0x77
#define COM_PKT_CMD_TRANSAC_B_TEST 		0x78
#define COM_PKT_CMD_LOOP_COUNT          0x79
#define COM_PKT_CMD_PRE_VALIDATION      0x7B
#define COM_PKT_CMD_POWER_OFF_TEST		0x7A

//Type A
#define COM_PKT_CMD_INIT_TYPEA					0x1E
#define COM_PKT_CMD_INIT_TYPEB					0x1F
#define COM_PKT_CMD_REQA                    	0x20
#define COM_PKT_CMD_TYPEA_HALT             		0x21
#define COM_PKT_CMD_TYPEA_MF1_READ          	0x22
#define COM_PKT_CMD_TYPEA_MF1_WRITE         	0x23
#define COM_PKT_CMD_TYPEA_MF1_WALLET_INIT   	0x24
#define COM_PKT_CMD_TYPEA_MF1_WALLET_INCREMENT 0x25
#define COM_PKT_CMD_TYPEA_MF1_WALLET_DECREMENT 0x26
#define COM_PKT_CMD_TYPEA_MF1_WALLET_READ       0x27
#define COM_PKT_CMD_TYPEA_MF0_READ              0x28
#define COM_PKT_CMD_TYPEA_MF0_WRITE             0x29
#define COM_PKT_CMD_TYPEA_RATS					0x2A
#define COM_PKT_CMD_EXCHANGE					0x2B
#define COM_PKT_CMD_DESELECT					0x2C
#define COM_PKT_CMD_MULTI_EXCHANGE_TEST			0x2D
#define COM_PKT_CMD_TEST_STOP					0x2E
#define COM_PKT_CMD_TYPEA_MF1_VALUE_BLOCK_OP	0x53
#define COM_PKT_CMD_TYPEA_MF1_AUTH             0x55
//TYPE B
#define COM_PKT_CMD_REQB                        0x30
#define COM_PKT_CMD_TYPEB_HALT                  0x31
#define COM_PKT_CMD_TYPEB_SR176_READ            0x32
#define COM_PKT_CMD_TYPEB_SR176_WRITE           0x33
#define COM_PKT_CMD_SELECT_SR					0x34
#define COM_PKT_CMD_PROTECT_SR176				0x35
#define COM_PKT_CMD_COMPLECT_SR176				0x36
#define COM_PKT_CMD_TYPEB_UID					0x37
#define COM_PKT_CMD_TYPEB_ATTRIB                0x56

//mifare
#define COM_PKT_CMD_mf1_block_init		0x38
#define COM_PKT_CMD_mf1_block_value_add		    0x39
#define COM_PKT_CMD_mf1_block_value_decrease	     0x3A

//mifare
#define COM_PKT_CMD_TYPEA_MF1_STEP_AUTH          0x3B
#define COM_PKT_CMD_TYPEA_MF1_STEP_READ          0x3C
#define COM_PKT_CMD_TYPEA_MF1_STEP_WRITE          0x3D

#define COM_PKT_CMD_TYPEC_FELICA_REQC			0x3E
#define COM_PKT_CMD_TYPEC_FELICA_POLLING		0x3F
#define	COM_PKT_CMD_ISO15693_INVENTORY			0x40
#define	COM_PKT_CMD_ISO15693_STAY_QUIET			0x41
#define	COM_PKT_CMD_ISO15693_RESET_TO_READY		0x42
#define	COM_PKT_CMD_ISO15693_SELECT				0x43
#define	COM_PKT_CMD_ISO15693_POLLING			0x44
#define	COM_PKT_CMD_ISO15693_GET_STATUS			0x45
#define	COM_PKT_CMD_ISO15693_GET_SYSTEM			0x46
#define	COM_PKT_CMD_ISO15693_READ_SINGLE		0x47
#define	COM_PKT_CMD_ISO15693_WRITE_SINGLE		0x48
#define	COM_PKT_CMD_ISO15693_CONFIG				0x49
#define COM_PKT_CMD_ISO15693_LOCK_BLOCK			0x4C
#define COM_PKT_CMD_ISO15693_READ_MULTIPLE		0x4D
#define COM_PKT_CMD_ISO15693_WRITE_MULTIPLE		0x4E
#define COM_PKT_CMD_ISO15693_WRITE_AFI			0x4F
#define COM_PKT_CMD_ISO15693_LOCK_AFI 			0x50
#define COM_PKT_CMD_ISO15693_WRITE_DSFID		0x51
#define COM_PKT_CMD_ISO15693_LOCK_DSFID			0x52
#define COM_PKT_CMD_TRANSCEIVE              0xFF

#define	COM_PKT_CMD_FELICA_CONFIG				0x4A

#define COM_PKT_CMD_ERR_STA_STATISTICS			0x4B
#ifdef __cplusplus
}
#endif

#endif
